#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 1e5 + 10;

int n, m;
struct Edge
{
    int a, b;
}edge[N];
struct OP
{
    int opt, u;
}op[N];
vector<int> v[N];
vector<int> ans;
bool st[N];
int p[N], nums[N];

int find(int x){
    if(x != p[x]){
        p[x] = find(p[x]);
    }
    return p[x];
}


int main(){



    cin >> n >> m;
    for(int i = 1, x; i <= n; i ++){
        cin >> x;
        v[i].push_back(x);
        p[i] = i;
    }

    for(int i = 1; i < n; i ++) cin >> edge[i].a >> edge[i].b;

    for(int i = 1, opt; i <= m; i ++){
        cin >> opt;
        if(opt == 1){
            int e;
            cin >> e;
            st[e] = true;
            op[i].opt = opt;
            op[i].u = e;
        }else if(opt == 2){
            int u, val;
            cin >> u >> val;
            v[u].push_back(val);
            op[i].opt = opt, op[i].u = u;
        }else{
            int u;
            cin >> u;
            op[i].opt = opt, op[i].u = u;
        }
    }



    for(int i = 1; i <= n; i ++) nums[i] = v[i][v[i].size() - 1];

    for(int i = 1; i < n; i ++){
        if(!st[i]){
            int a = edge[i].a, b = edge[i].b;
            int fa = find(a), fb = find(b);
            if(fa != fb){
                nums[fb] += nums[fa];
                p[fa] = fb;
            }
        }
    }

    for(int i = m; i >= 1; i --){
        if(op[i].opt == 1){
            int u = op[i].u;
            int a = edge[u].a, b = edge[u].b;
            int fa = find(a), fb = find(b);
            nums[fa] += nums[fb];
            p[fb] = fa;
        }else if(op[i].opt == 2){
            int u = op[i].u;
            int oldv = v[u][v[u].size() - 1], newv = v[u][v[u].size() - 2];
            int fa = find(u);
       
            nums[fa] += newv - oldv;
            v[u].pop_back();

            // int u=op[i].u;
			// int last=v[u].back();
			// v[u].pop_back();
			// nums[find(u)]+=(v[u].back()-last);
        }else{
            int u = op[i].u;
            int fa = find(u);
            ans.push_back(nums[fa]);
        }
    }

    for(int i = ans.size() - 1; i >= 0; i--){
        cout << ans[i] << '\n';
    }






    return 0;
}